package com.dyna.core.aop.annotation;

import com.dyna.core.validator.EnumValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

/**
 * @author huan.fu 2021/4/1 - 下午3:35
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD})
@Constraint(validatedBy = EnumValidator.class)
public @interface EnumValid {
    /**
     * 枚举的类型
     */
    Class<?> value();

    /**
     * 错误消息
     */
    String message() default "枚举类型的值不正确";

    /**
     * 获取枚举值的方法
     */
    String method() default "getValue";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

}
